/*    */ package org.apache.commons.dbutils;
/*    */ 
/*    */ import java.sql.ResultSet;
/*    */ import java.sql.ResultSetMetaData;
/*    */ import java.sql.SQLException;
/*    */ import java.util.HashMap;
/*    */ import java.util.Map;
/*    */ import java.util.Map.Entry;
/*    */ 
/*    */ public class MyBasicRowProcessor2 extends BasicRowProcessor
/*    */ {
/*    */   public Map<String, Object> toMap(ResultSet rs)
/*    */     throws SQLException
/*    */   {
/* 12 */     Map result = new CaseInsensitiveHashMap();
/* 13 */     ResultSetMetaData rsmd = rs.getMetaData();
/* 14 */     int cols = rsmd.getColumnCount();
/*    */ 
/* 16 */     for (int i = 1; i <= cols; i++) {
/* 17 */       result.put(rsmd.getColumnLabel(i), rs.getObject(i));
/*    */     }
/*    */ 
/* 20 */     return result;
/*    */   }
/*    */ 
/*    */   private static class CaseInsensitiveHashMap extends HashMap<String, Object>
/*    */   {
/* 37 */     private final Map<String, String> lowerCaseMap = new HashMap();
/*    */     private static final long serialVersionUID = -2848100435296897392L;
/*    */ 
/*    */     public boolean containsKey(Object key)
/*    */     {
/* 49 */       Object realKey = this.lowerCaseMap.get(key.toString().toLowerCase());
/* 50 */       return super.containsKey(realKey);
/*    */     }
/*    */ 
/*    */     public Object get(Object key)
/*    */     {
/* 60 */       Object realKey = this.lowerCaseMap.get(key.toString().toLowerCase());
/* 61 */       return super.get(realKey);
/*    */     }
/*    */ 
/*    */     public Object put(String key, Object value)
/*    */     {
/* 73 */       Object oldKey = this.lowerCaseMap.put(key.toLowerCase(), key);
/* 74 */       Object oldValue = super.remove(oldKey);
/* 75 */       super.put(key, value);
/* 76 */       return oldValue;
/*    */     }
/*    */ 
/*    */     public void putAll(Map<? extends String, ?> m)
/*    */     {
/* 82 */       for (Map.Entry entry : m.entrySet()) {
/* 83 */         String key = (String)entry.getKey();
/* 84 */         Object value = entry.getValue();
/* 85 */         put(key, value);
/*    */       }
/*    */     }
/*    */ 
/*    */     public Object remove(Object key)
/*    */     {
/* 92 */       Object realKey = this.lowerCaseMap.remove(key.toString().toLowerCase());
/* 93 */       return super.remove(realKey);
/*    */     }
/*    */   }
/*    */ }

/* Location:           C:\E\referenceProject\CRM参考\qikebao\WEB-INF\lib\qikebao.jar
 * Qualified Name:     org.apache.commons.dbutils.MyBasicRowProcessor2
 * JD-Core Version:    0.6.1
 */